//
//  ApplyManagerByOpenLockApi.m
//  SYDoorLock
//
//  Created by maple on 2016/11/8.
//  Copyright © 2016年 maplexk. All rights reserved.
//

#import "ApplyManagerByOpenLockApi.h"

@implementation ApplyManagerByOpenLockApi{
    NSDictionary *_dic;
}

-(id)initWithDic:(NSDictionary *)dic{
    if (self = [super init]) {
        _dic = dic;
    }
    return self;
}

- (NSString *)requestUrl {
    return @"shangyun/device/apply_grant";
}

- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPOST;
}

- (id)requestArgument {
    NSMutableDictionary *dic = [NSMutableDictionary getPubdicGuest];
    if (_dic[@"token"]) {
        [dic setObject:_dic[@"token"] forKey:@"token"];
        
    }
    if (_dic[@"uid"]) {
        [dic setObject:_dic[@"uid"] forKey:@"uid"];
        
    }
    if (_dic[@"device_id"]) {
        [dic setObject:_dic[@"device_id"] forKey:@"device_id"];
        
    }
    NSString *sign=[NSString getSign:dic];
    [dic setObject:sign forKey:@"sign"];
    return dic;
    
}

- (NSString *)userId {
    return [[[self responseJSONObject] objectForKey:@"userId"] stringValue];
}

//-(void)analyseResponseObject {
//    NSDictionary * dict = [self responseJSONObject];
//    NSLog(@"dict = %@",dict);
//    if ([dict[@"errcode"] intValue] == 0) {
//
//        [SVProgressHUD showSuccessWithStatus:@"修改密码成功！"];
//
//    } else {
//
//        [SVProgressHUD showErrorWithStatus:@"修改密码失败！"];
//    }
//}

-(void)dealloc
{
    NSLog(@"ApplyManagerByOpenLockApi dealloc");
}
@end
